*** Settings ***
Documentation           通过Redfish获取BCU板卡信息
Resource                ../../test_function/redfish/redfish.robot
Library                 RequestsLibrary
Library                 Collections
Library                 BuiltIn
Suite Setup             Create REDFISH_GET Session
Suite Teardown          Delete All Sessions

*** Variables ***
${INPUT_URI}        /Chassis/${CHASSIS_ID}/Boards/BCU1CpuBoard1

*** Test Cases ***
Get BCU Info Via Redfish
    [Documentation]    通过Redfish获取BCU板卡的信息
    [Tags]    Get_BCU_Info_Via_Redfish
    # 发送GET请求
    ${rsp}=    Run Keyword And Ignore Error    GET On Session    redfish_get   ${INPUT_URI}

    Run Keyword If     '${rsp[0]}' == 'FAIL'    Fail    msg=获取BCU板卡信息失败: ${rsp[1]}

    # 验证响应状态码
    Should Be Equal As Strings    ${rsp[1].status_code}    200    msg=预期状态码200,实际收到${rsp[1].status_code}

    # 打印响应内容
    Log    ${rsp[1].json()}    level=INFO

    # 验证bcu板卡信息的内容：ComponentUniqueID
    ${rsp_settings}=    Set Variable    ${rsp[1].json()}
    ${componentuniqueid_name}=    Set Variable    ComponentUniqueID

    # 检查响应中是否包含Atrributes
    Dictionary Should Contain Key    ${rsp_settings}    ${componentuniqueid_name}
    Log    bcu板卡${componentuniqueid_name}的值为: ${rsp_settings['${componentuniqueid_name}']}    level=INFO